package cn.edu.nuaa;

import cn.edu.nuaa.model.Classes;
import cn.edu.nuaa.model.User;
import cn.edu.nuaa.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        User user1 = applicationContext.getBean("user1", User.class);
        User user2 = applicationContext.getBean("user2", User.class);

        System.out.println("user1 = " + user1);
        System.out.println("user2 = " + user2);

        Classes class01 = applicationContext.getBean("class01", Classes.class);
        System.out.println("class01 = " + class01);

        UserService userService = applicationContext.getBean("userService", UserService.class);
        if (userService.login("123456", "123456")) {
            System.out.println("登陆成功");
        } else {
            System.out.println("登陆失败");
        }
        if (userService.login("1", "123456")) {
            System.out.println("登陆成功");
        } else {
            System.out.println("登陆失败");
        }
    }
}